package com.wx_shop.api.util.wx.dto;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="xml")
public class WeixinPayRes {

	/**
	 * 支付返回错误
	 * @author leiwuluan
	 */
	public static enum WeixinPayErrorCode {
		
		NOAUTH("商户无此接口权限"),
		NOTENOUGH("余额不足"),
		ORDERPAID("商户订单已支付"),
		ORDERCLOSED("订单已关闭"),
		SYSTEMERROR("系统错误"),
		APPID_NOT_EXIST("APPID不存在"),
		MCHID_NOT_EXIST("MCHID不存在"),
		APPID_MCHID_NOT_MATCH("appid和mch_id不匹配"),
		LACK_PARAMS("缺少参数"),
		OUT_TRADE_NO_USED("商户订单号重复"),
		SIGNERROR("签名错误"),
		XML_FORMAT_ERROR("XML格式错误"),
		REQUIRE_POST_METHOD("请使用post方法"),
		POST_DATA_EMPTY("post数据为空"),
		NOT_UTF8("编码格式错误");
		
		public String msg;
		private WeixinPayErrorCode(String msg){
			this.msg = msg;
		}
	}
	
	@XmlElement public String return_code; //><![CDATA[SUCCESS]]></return_code>
	@XmlElement public String return_msg; //><![CDATA[OK]]></return_msg>
	@XmlElement public String appid; //><![CDATA[wx2421b1c4370ec43b]]></appid>
	@XmlElement public String mch_id; //><![CDATA[10000100]]></mch_id>
	@XmlElement public String nonce_str; //><![CDATA[IITRi8Iabbblz1Jc]]></nonce_str>
	@XmlElement public String openid; //><![CDATA[oUpF8uMuAJO_M2pxb1Q9zNjWeS6o]]></openid>
	@XmlElement public String sign; //><![CDATA[7921E432F65EB8ED0CE9755F0E86D72F]]></sign>
	@XmlElement public String result_code; //><![CDATA[SUCCESS]]></result_code>
	@XmlElement public String prepay_id; //><![CDATA[wx201411101639507cbf6ffd8b0779950874]]></prepay_id>
	@XmlElement public String trade_type; //><![CDATA[JSAPI]]></trade_type>
	
	@XmlElement public String err_code; // 
	@XmlElement public String err_code_des;
	@XmlElement public String code_url;
	
	@Override
	public String toString() {
		return "WeixinPayRes [return_code=" + return_code + ", return_msg="
				+ return_msg + ", appid=" + appid + ", mch_id=" + mch_id
				+ ", nonce_str=" + nonce_str + ", openid=" + openid + ", sign="
				+ sign + ", result_code=" + result_code + ", prepay_id="
				+ prepay_id + ", trade_type=" + trade_type + "]";
	}
}
